<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <script type="text/javascript">
      //卡片的构造函数-----“类‘
      function Card(name,company,phone) {
          this.name=name;
          this.company=company;
          this.phone=phone;
      }
      //卡片管理器
      function CardManager() {
         this.arr=new Array();
      }
      //给卡片管理器添加方法
      //添加卡片
      CardManager.prototype.addCard=function (newCard) {
           this.arr.push(newCard);
      };
      //查看卡片
      CardManager.prototype.checkoutCard=function () {
           //查看卡片也就是遍历数组
          for(var index in this.arr){
              console.log("姓名是"+this.arr[index].name+"所在的公司"
              +this.arr[index].company);
          }
      };

      //验证方法
      //先创建几张卡片
      var c1=new Card("张三","百度","13380901100");
      var c2=new Card("李四","联想","13280401500");
      var c3=new Card("王五","阿里","18382901400");
      var c4=new Card("赵六","腾讯","15380905500");
      //创建卡片管理器
      var m1=new CardManager();
      m1.addCard(c1);
      m1.addCard(c2);
      m1.addCard(c3);
      m1.addCard(c4);
      m1.checkoutCard();








  </script>
</body>
</html>